﻿@{
    Layout = null;
}
@model ElingOA6_Admin_DSJCJ.Model.ItemPurchaseApply
<!DOCTYPE html>
@Html.Partial("LoadPanelPartial")
<html>
<head>
<title>用品采购申请</title>
      @if (false)
    {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/My97DatePicker/WdatePicker.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/json2.js",true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    
    @Html.DevExpress().GetStyleSheets(

                new StyleSheet { ExtensionType = ExtensionType.GridView, Theme = DevExpressHelper.Theme }

)
    @Html.DevExpress().GetScripts(
                    new Script { ExtensionType = ExtensionType.ListBox }
    )
    <script type="text/javascript">
        $(document).ready(function () {
            var type = $("#hdtype").val();
            var json = $("#hdjson").val();                       
            if(json != "")
            {
            var model = JSON.parse(json);
            var tableName = "additem";
            var array = "";            
                for (var i = 0; i < model.length; i++) {
                    array += model[i]["FItemNo"] + ",";
                    $("#hditemNo").val(array);
                    var rowId = model[i]["FItemNo"];
                    var spec = "spce" + model[i]["FItemNo"];
                    var qty = "qty" + model[i]["FItemNo"];
                    var price = "price" + model[i]["FItemNo"];
                    var amount = "amount" + model[i]["FItemNo"];
                    var requestdate = "requestdate" + model[i]["FItemNo"];
                    var note = "note" + model[i]["FItemNo"];
                    $("#additem").append("<tr id='" + model[i]["FItemNo"] + "'>" +
                    "<td align='center' class='tdClass'>" + model[i]["FItemPurchaseApplyEntryID"] + "</td>" +
                    "<td align='center' class='tdClass'>" + model[i]["FItemName"] + "</td>" +
                    "<td align='center' class='tdClass'><input name='" + spec + "' id='" + spec + "' type='text' value='" + model[i]["FItemSpec"] + "' style='width:100px' /></td>" +
                    "<td align='center' class='tdClass'><input name='" + qty + "' id='" + qty + "' type='text' value='" + model[i]["FQty"] + "' style='width:100px' onkeyup='qty()' /></td>" +
                    "<td align='center' class='tdClass'><input name='" + price + "' id='" + price + "' type='text' value='" + model[i]["FPrice"] + "' style='width:100px' onkeyup='price()' /></td>" +
                    "<td align='center' class='tdClass'><input name='" + amount + "' id='" + amount + "' type='text' value='" + model[i]["FAmount"] + "' style='width:100px' /></td>" +
                    "<td align='center' class='tdClass'><input name='" + requestdate + "' id='" + requestdate + "' value='" + model[i]["StrFRequestDate"] + "' onclick='WdatePicker({readOnly:true})' class='Wdate' /> </td>" +
                    "<td align='center' class='tdClass'><input name='" + note + "' id='" + note + "' type='text' value='" + model[i]["FNote"] + "' style='width:200px' /></td></tr>");                       
                }
            }

            $("#additem").find("input").each(function(){
                $(this).attr("disabled","disabled");
             });


        });

        function ok() {
            form1.submit();
            
        }

        function cancel() {
            window.location.href = rootPath + "/Admin/OfficeItemPurchaseApplyEntry/OfficeItemPurchaseApplyEntryList";
        }


    </script>
</head>
<body>
@using (Html.BeginForm("Save", "OfficeItemPurchaseApplyEntry", FormMethod.Post, new { id = "form1" }))
{

     <table width="1000" align="center" class="tableForm" border="0">
            <tr>
                <td align="right" class="tdClass" width="10%">采购申请单号:</td>
                <td class="tdClass">
                    @Html.DevExpress().Label(settings =>
               {
                   settings.Name = "FItemPurchaseApplyID";
                   settings.Width = 200;
                   settings.Height = 20;
                   settings.Text = Model.FItemPurchaseApplyID.ToString();
                   settings.Enabled = false;

               }).GetHtml()
                </td>
                 <td align="right" class="tdClass">填报日期:</td>
                <td class="tdClass">
                   @Html.DevExpress().TextBox(settings =>
              {
                  settings.Name = "FApplyDate";
                  settings.Width = 200;
                  
                  settings.Text = DateTime.Parse(Model.FApplyDate.ToString()).ToString("yyyy-MM-dd");
                  settings.Enabled = false;
                  settings.Properties.ValidationSettings.EnableCustomValidation = true;
              }).GetHtml()
                </td>
            </tr>
            <tr>
                <td align="right" class="tdClass">申请部门:</td>
                <td class="tdClass">
                   @Html.DevExpress().ComboBox(settings =>
              {
                  settings.Name = "FApplyDeptNo";
                  settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                  settings.Enabled = false;
                  settings.Height = 20;
                  settings.Width = 200;
                  settings.Properties.TextField = "Text";
                  settings.Properties.ValueField = "Value";
              }).BindList(ViewData["dept"] as List<SelectListItem>).Bind(Model.FApplyDeptNo).GetHtml()
                </td>
                 <td align="right" class="tdClass">申请人:</td>
                <td class="tdClass" >
                    @Html.DevExpress().ComboBox(settings =>
               {
                   settings.Name = "FApplyEmplNo";
                   settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                   settings.Enabled = false;
                   settings.Width = 200;
                   settings.Properties.TextField = "Text";
                   settings.Properties.ValueField = "Value";
               }).BindList(ViewData["empl"] as List<SelectListItem>).Bind(Model.FApplyEmplNo).GetHtml()
                </td>
            </tr>
              <tr>
                <td align="right" class="tdClass" >申请原因:</td>
                <td colspan="3" class="tdClass">
                    @Html.DevExpress().Memo(settings =>
               {
                   settings.Name = "FApplyReason";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(60);
                   settings.Height = 60;
                   settings.Text = Model.FApplyReason;
                   settings.Enabled = false;
                   settings.Properties.Rows = 3;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
            </tr>
            <tr>
            
                <td align="right" class="tdClass">
                    审批:
                </td>
                <td colspan="3" class="tdClass">
                    @Html.DevExpress().RadioButtonList(settings =>
               {
                   settings.Name = "FStatus";
                   settings.Properties.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Table;
                   settings.Properties.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                   settings.Properties.RepeatColumns = 3;
               }).BindList(new List<SelectListItem> { 
                            //new SelectListItem { Text = "新单", Value = "N" }, 
                            new SelectListItem { Text = "未通过", Value = "R" },                           
                            new SelectListItem { Text = "通过",Value = "A" },
                             new SelectListItem { Text = "退回", Value = "B" }
                        }).Bind(Model.FStatus).GetHtml()
                </td>
            </tr>


            <tr>
                <td colspan="4" class="tdClass">
                <table id="additem" width="600" align="center" border="0" class="tableForm">
                   <tr>
                        @*<td width="10%" class="tdClass" height="30" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "操作"; }).GetHtml()</td>*@
                        <td width="10%" class="tdClass" height="30" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "采购编号"; }).GetHtml()</td>
                        <td width="10%" class="tdClass" height="30" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "用品名称"; }).GetHtml()</td>
                        <td width="10%" class="tdClass" height="30" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "规格"; }).GetHtml()</td>  
                        <td width="10%" class="tdClass" height="30" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "数量"; }).GetHtml()</td>
                        <td width="10%" class="tdClass" height="30" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "单价"; }).GetHtml()</td>
                        <td width="10%" class="tdClass" height="30" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "金额"; }).GetHtml()</td>
                        <td width="10%" class="tdClass" height="30" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "要求日期"; }).GetHtml()</td> 
                        <td width="20%" class="tdClass" height="30" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "备注"; }).GetHtml()</td>                   
                    </tr>   
                </table>                                        
                </td>
            </tr>
    </table>
    <table width="100%" class="tableForm">
            <tr>
            <td width="40%">&nbsp;</td>
                <td align="center">
                 @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnOK";
                settings.Text = "确定";
                settings.ControlStyle.CssClass = "button";
                settings.Images.Image.Url = Url.Content("~/Content/ControlImages/ok.png");
                settings.ClientSideEvents.Click = "function(){ok()}";
            }).GetHtml()

                @Html.DevExpress().Button(settings =>
           {
               settings.Name = "btnCancel";
               settings.Text = "取消";
               settings.ControlStyle.CssClass = "button";
               settings.Images.Image.Url = Url.Content("~/Content/ControlImages/no.png");
               settings.CausesValidation = false;
               settings.ClientSideEvents.Click = "cancel";
           }).GetHtml()

                </td>
            </tr>
        </table>
    
    @Html.Hidden("hditemNo")
    @Html.Hidden("hdresult")
   @Html.Hidden("hdID", ViewData["id"])
    @Html.Hidden("hdtype", ViewData["type"])  
    
    @Html.Hidden("hddate", ViewData["FApplyDate"]) 
    
    @Html.Hidden("hdjson", ViewData["json"])
    
                                         
}
     <script type="text/javascript">
         lp.Hide();
    </script>
</body>
</html>
